package band.wukong.practice.springboot.boot.web.exception;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author wukong(wukonggg@139.com)
 */
@ControllerAdvice(basePackages = "band.wukong.practice.springboot.boot.web.exception")
public class GlobalExceptionHandlerInJspView {

    @ExceptionHandler(Exception.class)
    @ResponseBody
    public String handleException(Exception e) {
        if (e instanceof ArithmeticException) {
            return "error";
        } else {
            return "error";
        }
    }


}
